package com.hxkj.domain.enums;

import com.platform.common.domain.exception.CustomExceptionCode;

/**
 * 短信异常枚举类
 * <p>
 * Create by chenwei on 2018/7/10 9:52
 */
public enum MessageExceptionEnum implements CustomExceptionCode {

    PARAMETER_ERROR(100, "参数错误", 900),
    EXCEEDED_ACCESS_LIMIT(101,"超过访问次数限制",900);

    private Integer code;
    private String msg;
    private Integer httpCode;

    MessageExceptionEnum(Integer code, String msg, Integer httpCode) {
        this.code = code;
        this.msg = msg;
        this.httpCode = httpCode;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public void setCode(Integer code) {
        this.code = code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    @Override
    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public Integer getHttpCode() {
        return httpCode;
    }

    @Override
    public void setHttpCode(Integer httpCode) {
        this.httpCode = httpCode;
    }

    public static MessageExceptionEnum getEnumByCode(Integer code) {
        for (MessageExceptionEnum appletAgentExceptionEnum : MessageExceptionEnum.values()) {
            if (code.equals(appletAgentExceptionEnum.getCode())) {
                return appletAgentExceptionEnum;
            }
        }
        return null;
    }

}
